package com.hnkywl.sts.entity.sys;

import com.hnkywl.sts.entity.BaseEntity;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * 菜单
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-3-3
 * Time: 下午10:22
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_SYS_CD")
@Where(clause = "deleted!='1'")
public class Cd extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqCd", allocationSize = 1, sequenceName = "SEQ_SYS_CD")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqCd")
    private Long id;

    /**
     * 名称
     */
    private String mc;

    /**
     * url地址
     */
    @Column(length = 4000)
    private String url;

    /**
     * 父菜单
     */
    @ManyToOne
    @JoinColumn(name = "FCD_ID")
    private Cd fcd;

    /**
     * 页面层级
     */
    private Integer ymcj;
    /**
     * 菜单类型 系统菜单和报表统计
     */
    private String lx;

    /**
     * 排序号
     */
    private Long pxh;

    /**
     * 所有页面元素
     */
    @OneToMany(mappedBy = "cd", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Ymys.class)
    private List<Ymys> ymysList;

    /**
     * 所有功能操作
     */
    @OneToMany(mappedBy = "cd", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Gncz.class)
    private List<Gncz> gnczList;

    /**
     * 所有子菜单
     */
    @OneToMany(mappedBy = "fcd", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Cd.class)
    private List<Cd> cdList;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMc() {
        return mc;
    }

    public void setMc(String mc) {
        this.mc = mc;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Cd getFcd() {
        return fcd;
    }

    public void setFcd(Cd fcd) {
        this.fcd = fcd;
    }

    public Integer getYmcj() {
        return ymcj;
    }

    public void setYmcj(Integer ymcj) {
        this.ymcj = ymcj;
    }

    public String getLx() {
        return lx;
    }

    public void setLx(String lx) {
        this.lx = lx;
    }

    public Long getPxh() {
        return pxh;
    }

    public void setPxh(Long pxh) {
        this.pxh = pxh;
    }

    public List<Ymys> getYmysList() {
        return ymysList;
    }

    public void setYmysList(List<Ymys> ymysList) {
        this.ymysList = ymysList;
    }

    public List<Gncz> getGnczList() {
        return gnczList;
    }

    public void setGnczList(List<Gncz> gnczList) {
        this.gnczList = gnczList;
    }

    public List<Cd> getCdList() {
        return cdList;
    }

    public void setCdList(List<Cd> cdList) {
        this.cdList = cdList;
    }
}
